import {
  reqIndexData
} from "../../api/index"
Page({

  //初始化数据
  data: {
    bannerList: [], //轮播图数据
    categoryList: [], //商品导航数据
    activeList: [], //活动渲染数据
    hotList: [], //人气推荐
    guessList: [], //猜你喜欢,
    loading: true //是否显示骨架屏，默认显示
  },
  //获取首页数据
  async getIndexData() {
    //调用api接口，获取数据
    const res = await reqIndexData()
    // console.log(res)
    this.setData({
      bannerList: res[0].data,
      categoryList: res[1].data,
      activeList: res[2].data,
      guessList: res[3].data,
      hotList: res[4].data,
      loading: false
    })
  },


  //监听页面的加载
  onLoad() {
    //页面加载以后，调用获取首页数据
    this.getIndexData()
  },
  //实现转发功能
  onShareAppMessage() {

  },
  //能够把小程序分享到朋友圈
  onShareTimeline() {

  }


})